<?php
  
?><head>
<script language="javascript">
	function load_info(info)
	{
		var lol=(member_type.options[member_type.selectedIndex].value);
		if (lol)
		{
			<!--Den tin exw teleiwsei-->
		}
	}
</script>
</head>

<form method="post" action="<?php $_SERVER["PHP_SELF"]?>" name="thisform">
<center>
<br/><br/><br/><br/>
 <table>
    <tr>
        <td colspan=3 align=center>
                <h2><p style="color:blue">MEMBER UPDATE</p></h2>
        </td>
    </tr>
    
    
    <tr>
    	<td>
    		Choose Member:
        </td>
    	<td width="20">
        </td>
        <td>
        	<?
			include("Libraries\BusinessLogic\users.php");
			$query="SELECT username FROM member";
			$result=exec_sql_query($query);
			$options="";
			
			while ($row=mysql_fetch_array($result))
			{
			
				$user=$row["username"];
				$options.="<OPTION VALUE=\"$user\">".$user;
			}
			?>
			<SELECT NAME="username" onchange="document.thisform.user.value=this.value">
			<OPTION VALUE=0>Choose
			<?=$options?>
			</SELECT>
        </td>
    </tr>
    
    
    <tr>
        <td align=top>
           Username:
        </td>
                <td width=20>
        </td>
        <td>
            <input type="text" name="user">     
        </td>
    </tr>
    <tr>
        <td align=top>
           Password:
                      </td>
                <td width=20>
        </td>
        <td>
            <input type="password" name="pass">      
        </td>
    </tr>
    <tr>
        <td align=top>
           Email:
                      </td>
                <td width=20>
        </td>
        <td>
            <input type="email" name="email">      
        </td>
    </tr>
    <tr>
        <td align=top>
           Member Type:
        </td>
                <td width=20>
        </td>
        <td>
            <select name="member_type">
  				<option value="1">Admin </option>
 				<option value="2">Member</option>
  			</select>   
        </td>
    <tr>
        <td colspan=3 align=center>          
            <input type="submit" value="Update">
        </td>
    </tr>
    <tr>
        <td colspan=3 align=center>          
          <?php 
		  
		  if(isset($_POST["user"]))
		  { 
		  	$user=$_POST["user"];
    		$pass=$_POST["pass"];
			$email=$_POST["email"]; 
			$member_type=$_POST["member_type"];
		    update_member($user,$pass,$email,$member_type);
		  }
		  ?>
        </td>
    </tr>
    <tr>
        <td colspan=3 align=center>          
        
        </td>
    </tr>
</table>
</form>
